package com.tmt.im.service.controller.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.*;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;

import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED;
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/8/28 16:37
 * @Version 1.0
 **/
@Getter
@Setter
@Tag(name = "更新群配置信息请求对象", description = "更新群配置信息请求对象")
public class UpdateSessionRequest implements Serializable {

    @Serial
    private static final long serialVersionUID = 2567393804639378227L;

    @Schema(requiredMode = REQUIRED, description = "群组ID")
    @NotNull(message = "群主ID不允许为空")
    private Long tid;

    @Schema(requiredMode = NOT_REQUIRED, description = "群组名称")
    @Nullable
    @Size(max = 64, message = "群名称最大长度64个字符")
    private String name;

    @Schema(requiredMode = NOT_REQUIRED, description = "群组头像")
    @Nullable
    private String avatar;

    @Schema(requiredMode = NOT_REQUIRED, description = "群组公告")
    @Nullable
    private String announcement;

    @Schema(requiredMode = NOT_REQUIRED, description = "群组简介")
    @Nullable
    private String introduce;

    @Schema(requiredMode = NOT_REQUIRED, description = "群组最大成员数, 取值范围：2-200")
    @Nullable
    @Min(value = 2, message = "群成员数量限制不能少于2")
    @Max(value = 5000, message = "群成员数量限制不能大于5000")
    private Integer membersLimit;

    @Schema(requiredMode = NOT_REQUIRED, description = "通过 SDK 侧操作申请入群的验证方式。\n" +
            "true：无需验证，直接入群。\n" +
            "false(默认)：需要群主或管理员验证通过才能入群。")
    @Nullable
    @JsonProperty("inviteState")
    private Boolean joinMode;

    @Schema(requiredMode = NOT_REQUIRED, description = "群组禁言状态。\n" +
            "true(默认)：取消群组禁言。\n" +
            "false：禁言全体成员。")
    @Nullable
    @JsonProperty("shutupState")
    private Boolean chatBannedMode;

    @Schema(description = "群成员禁止互相添加好友——true:禁止。false:不禁止")
    @JsonProperty("addFriendsState")
    @Nullable
    private Boolean forbidAddFriend;

    @Schema(description = "抢手气红包状态——true:允许。false:禁止")
    @Nullable
    private Boolean nonCollectionState;

    /*******************以下为扩展的配置参数****************************/

    @Schema(requiredMode = NOT_REQUIRED, description = "自定义群组扩展字段，第三方可以跟据此属性自定义扩展自己的群属性，\n" +
            "建议封装成 JSON 格式，{key:value}。长度上限 1024 位字符。V9版本的custom字段")
    @Nullable
    private String serverExtension;

    @Schema(requiredMode = NOT_REQUIRED, description = "自定义扩展字段，即自定义的通知字段，JSON 格式，不会持久化。长度上限 512 位字符。V9版本的attach字段")
    @Nullable
    private String extension;

    @Schema(requiredMode = NOT_REQUIRED, description = "群创建完成后，邀请入群时是否需要被邀请人的同意。\n" +
            "0（默认）：需要被邀请人同意才能入群。\n" +
            "1：不需要被邀请人同意，直接入群。")
    @Nullable
    private Integer beInvitedMode;

    @Schema(requiredMode = NOT_REQUIRED, description = "邀请权限，即谁可以邀请他人入群。\n" +
            "0（默认）：群主和管理员。\n" +
            "1：所有人。")
    @Nullable
    private Integer inviteMode;

    @Schema(requiredMode = NOT_REQUIRED, description = "客户端修改群组信息的权限，即谁可以修改群组信息。\n" +
            "0（默认）：群主和管理员。\n" +
            "1：所有人。")
    @Nullable
    private Integer updateTeamInfoMode;

    @Schema(requiredMode = NOT_REQUIRED, description = "客户端修改群自定义扩展信息（server_extension&extension）权限，即谁可以修改群自定义扩展信息。\n" +
            "0（默认）：群主和管理员。\n" +
            "1：所有人。")
    @Nullable
    private Integer updateExtensionMode;

}
